<?php
use yii\helpers\Url;
use yii\web\View;
use app\assets\ReportAsset;
ReportAsset::register($this);
$this->title = '数据报表 -- Sacrebleu DSP';
?>
<div class="col-sm-6">
  <ol class="breadcrumb">
    <li>数据报表</li>
    <li class="active">数据</li>
  </ol>
</div>
</div>
<div class="row">
  <h3 class="page-title">
    <i class="fa fa-line-chart"></i>
    数据报表
    <small></small>
  </h3>
</div>
<div class="panel">
  <div class="panel-body">
    <div class="panel panel-dotted">
      <div class="panel-heading">
        <h4>
          <i class="fa fa-filter"></i>
          筛选条件
        </h4>
      </div>
      <div class="panel-body">
        <form class="form-horizontal" id="filter-frm" method="POST" action="#" role="form">
          <div class="row">
            <div class="col-sm-4">
              <div class="form-group">
                <label for="filter_market" class="col-sm-4 control-label">选择市场：</label>
                <div class="col-sm-8">
                  <select class="form-control" id="filter_market" name="ad_network_id" >
                    <option value="0">全部</option>
                  </select>
                </div>
              </div>
            </div>
            <div class="col-sm-4">
              <div class="form-group">
                <label for="filter_campaign" class="col-sm-4 control-label">选择活动：</label>
                <div class="col-sm-8">
                  <select class="form-control" id="filter_campaign" name="campaign" >
                    <option value="all">全部</option>
                  </select>
                </div>
              </div>
            </div>
            <div class="col-sm-4">
              <div class="form-group">
                <label for="filter_launch" class="col-sm-4 control-label">选择投放：</label>
                <div class="col-sm-8">
                  <select class="form-control" id="filter_launch" name="launch" >
                    <option value="all">全部</option>
                  </select>
                </div>
              </div>
            </div>
            <div class="col-sm-4">
              <div class="form-group">
                <label for="filter_strategy" class="col-sm-4 control-label">选择策略：</label>
                <div class="col-sm-8">
                  <select class="form-control" id="filter_strategy" name="strategy" >
                    <option value="all">全部</option>
                  </select>
                </div>
              </div>
            </div>
          </div>
          <div class="row">
            <div class="col-sm-4">
              <div class="form-group">
                <label for="filter_date" class="col-sm-4 control-label"> 时间选择：</label>
                <div class="col-sm-8">
                  <div class="input-group">
                  <span class="input-group-btn">
                    <button class="btn btn-default" id="range-date-btn" type="button"><i class="fa fa-calendar"></i></button>
                  </span>
                  <input type="text" class="form-control" id="range-date" name="range_date" value="" placeholder="点击左侧按钮选择时间范围，格式为YYYY/MM/DD - YYYY/MM/DD" title="点击左侧按钮选择时间范围，格式为YYYY/MM/DD - YYYY/MM/DD" readonly>
                </div>
                </div>
              </div>
            </div>
          </div>
          <div class="row">
            <div class="col-sm-4">
              <div class="form-group">
                <div class="col-sm-8 col-sm-offset-4">
                  <button class="btn btn-success" type="submit" data-loading-text="<i class='fa fa-spinner fa-spin'></i> 查询中..."><i class="fa fa-search"></i> 查询</button>
                </div>
              </div>
            </div>
          </div>
        </form>
      </div>
    </div>
    <div class="panel panel-dotted">
      <div class="panel-heading">
        <h4><i class="fa fa-pie-chart"></i> 数据趋势</h4>
      </div>
      <div class="panel-body">
        <div class="row">
          <div class="col-sm-12">
            <!-- <div class="chart-filter" style="margin-bottom: 10px; overflow:hidden;">
              <div id="total-date-op" class="chart-date-op pull-right">
                <div data-toggle="buttons" class="btn-group">
                  <label class="btn btn-default btn-sm active">
                    <input type="radio" checked="" value="day" name="date-options">按日</label>
                  <label class="btn btn-default btn-sm">
                    <input type="radio" value="week" name="date-options">按周</label>
                  <label class="btn btn-default btn-sm">
                    <input type="radio" value="month" name="date-options">按月</label>
                </div>
              </div>
            </div> -->
            <div class="chart-holder" id="summary-report-data"></div>
          </div>
        </div>
      </div>
    </div>
    <div class="panel panel-dotted">
      <div class="panel-heading">
        <h4><i class="fa fa-table"></i> 数据列表</h4>
      </div>
      <div class="panel-body">
        <div class="row">
          <div class="col-sm-12">     
            <div class="table-responsive">
              <table class="table table-hover" id="data-table">
                <thead>
                  <tr>
                    <th>投放</th>
                    <!-- <th>媒体</th> -->
                    <th>市场</th>
                    <th>广告主</th>
                    <th>花费</th>
                    <th>展现数</th>
                    <th>点击数</th>
                    <th>点击率</th>
                    <th>CPM</th>
                    <th>CPC</th>
                    <!-- <th>转化率</th>
                    <th>转化金额</th> -->
                  </tr>
                </thead>
                <tbody></tbody>
              </table>
              <table class="table table-condensed table-total">
                <tbody>
                  <tr class="total-title">
                    <td colspan="2" rowspan="2">
                      <strong>总计</strong>
                    </td>
                    <td>花费</td>
                    <td>展现数</td>
                    <td>点击数</td>
                    <td>点击率</td>
                    <td>CPM</td>
                    <td>CPC</td>
                  </tr>
                  <tr class="total-data">
                    <td>
                      <p class="text-success"><i class="fa fa-rmb"></i> 0.00</p>
                      <p class="text-success"><i class="fa fa-rmb"></i> 0.00</p>
                    </td>
                    <td>0</td>
                    <td>0</td>
                    <td>0.00 %</td>
                    <td>
                      <p class="text-success"><i class="fa fa-rmb"></i> 0</p>
                      <p class="text-success"><i class="fa fa-rmb"></i> 0</p>
                    </td>
                    <td>
                      <p class="text-success"><i class="fa fa-rmb"></i> 0</p>
                      <p class="text-success"><i class="fa fa-rmb"></i> 0</p>
                    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<?php
  $dataUrl = Url::to(['get-all-report-data']);
  //$dataUrl = Yii::getAlias('@web').'/response/report/reportDataList.php';
  $marketToCampaign = $adnetworkOnLabel;
  $campaignToLauch  = $labelOnCampaign;
  $launchToStrategy = $campaignOnSolution;

  //$marketToCampaign = '{"万流客": {"id": "mk01", "value": [{"id": "cp01", "value": "campaign01"}, {"id": "cp02", "value": "campaign02"}]}, "新浪": {"id": "mk02", "value": [{"id": "cp03", "value": "campaign03"}]}}';
  //$campaignToLauch  = '{"campaign01": {"id": "cp01", "value": [{"id": "lh01", "value": "launch01"},{"id": "lh02", "value": "launch02"}]}, "campaign02": {"id": "cp02", "value": [{"id": "lh03", "value": "launch03"},{"id": "lh04", "value": "launch04"}]}, "campaign03": {"id": "cp03", "value": [{"id": "lh05", "value": "launch05"}]}}';
  //$launchToStrategy = '{"launch01": {"id": "lh01", "value": [{"id": "sg01", "value": "strategy01"}, {"id": "sg02", "value": "strategy02"}, {"id": "sg03", "value": "strategy03"}]}, "launch02": {"id": "lh02", "value": [{"id": "sg04", "value": "strategy04"},{"id": "sg05", "value": "strategy05"}]}, "launch03": {"id": "lh03", "value": [{"id": "sg06", "value": "strategy06"},{"id": "sg07", "value": "strategy07"}]}, "launch04": {"id": "lh04", "value": [{"id": "sg08", "value": "strategy08"},{"id": "sg09", "value": "strategy09"}]}, "launch05": {"id": "lh05", "value": [{"id": "sg10", "value": "strategy10"},{"id": "sg11", "value": "strategy11"}]}}';
  $this->registerJs("SL.setVar('MARKET_TO_CAMPAIGN','$marketToCampaign');", View::POS_END);
  $this->registerJs("SL.setVar('CAMPAIGN_TO_LAUNCH','$campaignToLauch');", View::POS_END);
  $this->registerJs("SL.setVar('LAUNCH_TO_STRATEGY','$launchToStrategy');", View::POS_END);
  $this->registerJs("SL.setVar('REPORT_DATA_LIST','$dataUrl');", View::POS_END);
  $this->registerJsFile('@web/js/report/sl.creativeReportList.js', ['depends' => 'app\assets\ReportAsset']);
?>
